#!/usr/bin/env ruby

LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME)))

require "#{LKP_SRC}/lib/string_ext"
require "#{LKP_SRC}/lib/tests/stats"
stats = LKP::Stats.new

while (line = $stdin.gets)
  line = line.resolve_invalid_bytes

  case line
  when /^### (\w+_\d+):$/
    item = Regexp.last_match[1]
    stats[item] ||= 'skip'
  when /^(\w+_\d+): (fail|pass|skip|ignored_by_lkp)$/
    item = Regexp.last_match[1]
    result = Regexp.last_match[2]
    stats[item] = result
  end

end

stats.dump
